package com.bw.yk07;

import org.wltea.analyzer.core.IKSegmenter;
import org.wltea.analyzer.core.Lexeme;
import scala.tools.nsc.doc.model.Public;

import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;

public class MyIKUtil {

    public static List<String> getIKwords(String s)
    {
        List<String> list=new ArrayList<>();

        StringReader sr=new StringReader(s);
        IKSegmenter iks=new IKSegmenter(sr,false);

        Lexeme lem=null;
        try
        {
            lem=iks.next();
            while (lem!=null)
            {
                String word=lem.getLexemeText();
                list.add(word);
                lem=iks.next();
            }
        }catch (Exception e)
        {
            e.printStackTrace();
        }

        return list;
    }

    public static void main(String[] args) {
        System.out.println(MyIKUtil.getIKwords("八维计算机软件学院"));

    }
}
